package com.hisan.freeride.home.activity;

import android.app.Activity;
import android.content.Context;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

import com.hisan.freeride.R;
import com.hisan.freeride.common.base.BaseActivity;
import com.hisan.freeride.common.view.BottomDialog;
import com.hisan.freeride.common.view.CustomButton;
import com.hisan.freeride.databinding.ActivityDetalisBinding;
import com.hisan.freeride.home.adapter.ActivityAdapter;
import com.jwenfeng.library.pulltorefresh.BaseRefreshListener;

/**
 * 创建时间 : 2017/12/8
 * 创建人：yangyingqi
 * 公司：嘉善和盛网络有限公司
 * 备注：活动详情
 */
public class ActivityDetalis extends BaseActivity<ActivityDetalisBinding>{
    private ActivityAdapter activityAdapter;

    @Override
    protected int getLayoutId() {
        return R.layout.activity_detalis;
    }

    @Override
    protected void initView() {
    mBinding.setStateModel(mStateModel);
    mBinding.pull.setCanLoadMore(false);
        mBinding.pull.setRefreshListener(new BaseRefreshListener() {
            @Override
            public void refresh() {
                mBinding.pull.finishRefresh();
            }
            @Override
            public void loadMore() {
                mBinding.pull.finishLoadMore();
            }
        });
    }

    @Override
    protected void initEvent() {
        mBinding.topBack.setOnClickListener(v -> finishActivity(true));
        mBinding.questions.setOnClickListener(v -> {
            BottomDialog.create(getSupportFragmentManager())
                    .setLayoutRes(R.layout.dialog_comment_view)
                    .setViewListener(v1 -> {
                        EditText mEditText = v1.findViewById(R.id.edit_text);
                        CustomButton mButton = v1.findViewById(R.id.comment_btn);
                        mEditText.post(() -> {
                            InputMethodManager imm = (InputMethodManager) this.getSystemService(Context.INPUT_METHOD_SERVICE);
                            imm.showSoftInput(mEditText, 0);
                        });
                        mButton.setOnClickListener(v2 -> {
                        });
                    })
                    .setDimAmount(0.6f)
                    .setCancelOutside(false)
                    .setTag("comment")
                    .show();
        });

    }

    @Override
    protected void loadData(boolean isRefresh) {

    }
}
